// import xhr from 'XHR';

/**
 *  ajax工具类
 */
class XHR {
  constructor (...args) {
  }
  // static apiDomain = webConfig.apiDomain
  // static apiDomain = '//sgmw.autobaojun.cn/510/20180901/m/ci/index.php'
  // xhr工具
  static xhr = {
    get(url, data) {
      return new Promise((resolve, reject) => {
      	$.ajax({
	      url: XHR.apiDomain + url,
	      dataType: "jsonp",
	      type: "get",
	      success: function (json) {
	        resolve(res)
	      },
	      error: function (err) {
	        reject(res)
	      }
	    });
      })
    },
    post(url, data) {
      return new Promise((resolve, reject) => {
        $.ajax({
	      url: XHR.apiDomain + url,
	      dataType: "jsonp",
	      type: "get",
	      success: function (json) {
	        resolve(res)
	      },
	      error: function (err) {
	        reject(res)
	      }
	    });
      })
    }
  }
}

export default XHR